Help with correct php syntax [migrated]

Posted by Robert hue on Programmers See other posts from Programmers or by Robert hue
Published on 2012-10-19T19:58:03Z Indexed on 2012/10/19 23:19 UTC
Read the original article Hit count: 236

Filed under:
|
|

I was working on some php functions and I got confused with php syntax. Here is the function.

Is this correct? to use add_filter inside function_exists check

if ( ! function_exists( 'disable_password_reset' ) ) :
  function disable_password_reset() {
    return false;
  }
  add_filter ( 'allow_password_reset', 'disable_password_reset' );
endif;

or this one is correct, to use add_filter outside function_exists check

if ( ! function_exists( 'disable_password_reset' ) ) :
  function disable_password_reset() {
    return false;
  }
endif;
add_filter ( 'allow_password_reset', 'disable_password_reset' );

I was working on Wordpress if that matters.

© Programmers or respective owner

Related posts about php

Related posts about functions